<%@ page contentType="text/html; charset=UTF-8" %>
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@ page import="com.wlcorp.forcazamis.domain.pi.Pidetail" %>
<%@ page import="com.wlcorp.forcazamis.sys.util.CommonUtil" %>
<%
	List pidetailList = (List)request.getAttribute("pidetailList");
%>
<html>
<head>
	<title>PI列表</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0">
	<link href="${pageContext.request.contextPath}/css/css.css" rel=stylesheet>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/button_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/form_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/table_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/pagetitle_css.css" type="text/css">
	<script language="javascript" src="${pageContext.request.contextPath}/script/common.js"></script>
	<script type="text/javascript">
    	function pidetailDetail(piid){
    		parent.location = "${pageContext.request.contextPath}/pi/pidetailManager.do?method=getPidetail&piid=" + piid;
    	}
    	function deleteRecord(piid){
    		if(confirm("确定删除？")){
    			window.location = "${pageContext.request.contextPath}/pi/pidetailManager.do?method=deletePidetail&piid=" + piid;
    		}
    	}
    	function printPiDetail(piid){
			window.open("${pageContext.request.contextPath}/pi/pidetailManager.do?method=printPi&piid=" + piid);
		}
    </script>
</head>
<body bgcolor="#ffffff">
  <center>
	<table width="90%" border="0" cellspacing="1" cellpadding="0" bgcolor="#999999">
          <tr bgcolor="#E7E7E7">
            <td class="bigtext" align="center" width="5%">序号</td>
            <td class="bigtext" align="center">合同编号</td>
            <td class="bigtext" align="center">来源</td>
            <td class="bigtext" align="center">下单日期</td>
            <td class="bigtext" align="center">总金额</td>
            <td class="bigtext" align="center">翻单</td>
            <td class="bigtext" align="center">新单</td>
            <td class="bigtext" align="center">制单人</td>
            <td class="bigtext" align="center">合同状态</td>
            <td class="bigtext" align="center">操作</td>
          </tr>
          <% 
          if(null!=pidetailList&&pidetailList.size()>0){
          		int index = 0;
          		for(Iterator iter = pidetailList.iterator();iter.hasNext();){
          			Pidetail pidetail = (Pidetail)iter.next();
          			index++;
          %>
          <tr bgcolor="#ffffff" onmouseover="this.style.backgroundColor='#bbdffb';" onmouseout="this.style.backgroundColor='#ffffff'">
            <td align="center" class="td5px"><%=index%></td>
            <td class="td5px"><%=pidetail.getPiCode()%></td>
            <td class="td5px"><%=pidetail.getSource() == null?"":pidetail.getSource().getSourceName()%></td>
            <td class="td5px"><%=pidetail.getPiDate()%></td>
            <td class="td5px"><%=CommonUtil.format2Scale(pidetail.getTotalSum())%></td>
            <td class="td5px"><%=CommonUtil.format2Scale(pidetail.getRePiSum())%></td>
            <td class="td5px"><%=CommonUtil.format2Scale(pidetail.getNewPiSum())%></td>
            <td class="td5px" align="center"><%=pidetail.getCreator() == null?"":pidetail.getCreator().getStaffName()%></td>
            <td class="td5px" align="center">
            <%if(pidetail.getStateName().equals("审批中")){
            	out.print("<font style='color:blue; font-weight:blod'><b>审批中</b></font>");
            }else if(pidetail.getStateName().equals("审批完成")){
            	out.print("<font style='color:red; font-weight:blod'><b>审批完成</b></font>");
            }else{
            	out.print(pidetail.getStateName());
            }
            %>
            </td>
            <td class="td5px" align="center">
            <a href="javascript:printPiDetail('<%=pidetail.getPiid()%>')">打印</a>&nbsp;
            <a href="javascript:pidetailDetail('<%=pidetail.getPiid()%>')">修改</a>&nbsp;
            <a href="javascript:deleteRecord('<%=pidetail.getPiid()%>')">删除</a></td>
		  </tr>
          <%}}%>
          <tr bgcolor="#ffffff" onmouseover="this.style.backgroundColor='#bbdffb';" onmouseout="this.style.backgroundColor='#ffffff'">
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td align="center" class="td5px"><a href="javascript:pidetailDetail('')">新增PI</a>&nbsp;</td>
          </tr>
	</table>
	<table><tr><td><%=request.getAttribute("pageURL")%></td></tr></table>
  </center>
  ${message}
</body>
</html>
